/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.1  (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the
 * License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
/**
 * Nudr_DataRepository API OpenAPI file
 * Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB,
 * ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
 *
 * The version of the OpenAPI document: 2.1.2
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator
 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
 * the class manually.
 */

#include "IpAddress.h"

namespace oai::udr::model {

IpAddress::IpAddress() {
  m_Ipv4Addr = "";
  m_Ipv4AddrIsSet = false;
  m_Ipv6AddrIsSet = false;
  m_Ipv6PrefixIsSet = false;
}

IpAddress::~IpAddress() {}

void IpAddress::validate() {
  // TODO: implement validation
}

void to_json(nlohmann::json &j, const IpAddress &o) {
  j = nlohmann::json();
  if (o.ipv4AddrIsSet())
    j["ipv4Addr"] = o.m_Ipv4Addr;
  if (o.ipv6AddrIsSet())
    j["ipv6Addr"] = o.m_Ipv6Addr;
  if (o.ipv6PrefixIsSet())
    j["ipv6Prefix"] = o.m_Ipv6Prefix;
}

void from_json(const nlohmann::json &j, IpAddress &o) {
  if (j.find("ipv4Addr") != j.end()) {
    j.at("ipv4Addr").get_to(o.m_Ipv4Addr);
    o.m_Ipv4AddrIsSet = true;
  }
  if (j.find("ipv6Addr") != j.end()) {
    j.at("ipv6Addr").get_to(o.m_Ipv6Addr);
    o.m_Ipv6AddrIsSet = true;
  }
  if (j.find("ipv6Prefix") != j.end()) {
    j.at("ipv6Prefix").get_to(o.m_Ipv6Prefix);
    o.m_Ipv6PrefixIsSet = true;
  }
}

std::string IpAddress::getIpv4Addr() const { return m_Ipv4Addr; }
void IpAddress::setIpv4Addr(std::string const &value) {
  m_Ipv4Addr = value;
  m_Ipv4AddrIsSet = true;
}
bool IpAddress::ipv4AddrIsSet() const { return m_Ipv4AddrIsSet; }
void IpAddress::unsetIpv4Addr() { m_Ipv4AddrIsSet = false; }
Ipv6Addr IpAddress::getIpv6Addr() const { return m_Ipv6Addr; }
void IpAddress::setIpv6Addr(Ipv6Addr const &value) {
  m_Ipv6Addr = value;
  m_Ipv6AddrIsSet = true;
}
bool IpAddress::ipv6AddrIsSet() const { return m_Ipv6AddrIsSet; }
void IpAddress::unsetIpv6Addr() { m_Ipv6AddrIsSet = false; }
Ipv6Prefix IpAddress::getIpv6Prefix() const { return m_Ipv6Prefix; }
void IpAddress::setIpv6Prefix(Ipv6Prefix const &value) {
  m_Ipv6Prefix = value;
  m_Ipv6PrefixIsSet = true;
}
bool IpAddress::ipv6PrefixIsSet() const { return m_Ipv6PrefixIsSet; }
void IpAddress::unsetIpv6Prefix() { m_Ipv6PrefixIsSet = false; }

} // namespace oai::udr::model
